﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Northwinddemo.BusinessLayer.Models.PartialSequencer
{
    public class PartialSequencer
    {
        private const string PARTIAL_SEQUENCER = "PartialSequencer";

        private HttpContextBase context;

        public PartialSequencer(HttpContextBase context)
        {
            this.context = context;
        }

        public void Next()
        {
            if (context.Items[PARTIAL_SEQUENCER] == null)
            {
                context.Items[PARTIAL_SEQUENCER] = 1;
                return;
            }
            int sequence = (int)context.Items[PARTIAL_SEQUENCER];
            sequence++;
            context.Items[PARTIAL_SEQUENCER] = sequence;
        }

        public int Current()
        {
            return (int)context.Items[PARTIAL_SEQUENCER];
        }

    }
}
